//-----------------------------------------------------------------------
// <copyright file="DeviceSpecific.cpp" company="Microsoft">
//      Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// Module:
//      DeviceSpecific.cpp
//
// Description:
//      Implements the device specific code for the driver.
//
//      This file contains device specific information, for example, how
//      to send data to the XYZ device as opposed to the ABC device.
//
//      This sample implementation doesn't do anything - it only contains
//      the stubs to be implemented later
//
//-----------------------------------------------------------------------

#include "Common.h"

extern bool g_fDeviceIsValid;


HRESULT SetDeviceParamDWORD(LPCWSTR pwszParamName, DWORD dwValue = 0);


HRESULT DeviceSpecificDisplayBitmap(const BYTE* pbBitmapData, DWORD cbBitmapData, DWORD dwRenderFlags)
{
    // Send a bitmap to your device here.
    // The bitmap is in buffer pbBitmapData of size (in bytes) cbBitmapData
    // For Example: SendBitmap(pbBitmapData, cbBitmapData);

    UNREFERENCED_PARAMETER(pbBitmapData);
    UNREFERENCED_PARAMETER(cbBitmapData);
    UNREFERENCED_PARAMETER(dwRenderFlags);

    return S_OK;
}


HRESULT DeviceDisplayInitialization(PCWSTR pwszDeviceInstanceId, IWDFNamedPropertyStore *pPropStore)
{
    UNREFERENCED_PARAMETER(pwszDeviceInstanceId);
    UNREFERENCED_PARAMETER(pPropStore);

    // Optionally check if the device has already been initialized
    // If it has, don't initialize a second time
    // Make sure to set this variable to true after initializing.
    if (true == g_fDeviceIsValid)
    {
        return E_FAIL;
    }

    // Initialize your device here.

    // Set the device capabilities
    CDevice::SetDeviceCaps(L"Windows SideShow Bitmap Driver (NoDevice Sample)", // wszDeviceFriendlyName
                           L"Microsoft", // wszDeviceManufacturer
                           L"1.0.3.1", // wszDeviceFirmwareVersion
                           320, // dwDeviceHorizontalResolution
                           240, // dwDeviceVerticalResolution
                           1); // dwDeviceBitDepth

    // Set the renderer capabilities
    CRenderer::SetRendererCaps(L"Tahoma", // wszFontName
                               11, // wFontSizeInPixels
                               18, // wTitlebarHeight
                               13, // wMenuItemHeight
                               13); // wScrollAmountInPixels

    return S_OK;
}


HRESULT DeviceButtonsInitialization(void)
{
    // Initialize button callbacks here.
    // This might be a thread, or registering a callback function.
    // Start Read Thread

    return S_OK;
}


HRESULT DeviceDisplayShutdown(void)
{
    // Optionally check if the device has already been shutdown
    // If it has, don't shutdown a second time
    // Make sure to set this variable to false after shutting down.
    if (false == g_fDeviceIsValid)
    {
        return E_FAIL;
    }

    // Shutdown the device here.

    CRenderer::ReleaseRendererCaps();
    CDevice::ReleaseDeviceCaps();

    return S_OK;
}


HRESULT DeviceButtonsShutdown(void)
{
    // Shutdown button callbacks here.
    // This might be stopping the thread or unregistering the callback

    return S_OK;
}


HRESULT ConfigureDevice()
{
    // The user picked the "Configure" option from the context menu of the home screen of the device

    // Do configuration work here. For example, open the SideShow Control Panel.

    return S_OK;
}


// used for setting the theme index in the device property store
HRESULT SetDeviceParamDWORD(LPCWSTR pwszParamName, DWORD dwValue)
{
    UNREFERENCED_PARAMETER(pwszParamName);
    UNREFERENCED_PARAMETER(dwValue);

    return S_OK;
}
